home *** CD-ROM | disk | FTP | other *** search
/ PCMania 75 / PCMania CD75_1.iso / lycos / netscape / netcast.z / ncjs10.jar / layout.js < prev    next >
Text File  |  1997-11-26  |  2KB  |  75 lines

  1. /*
  2.  * layout.js
  3.  * 
  4.  * Copyright (c) 1997 Netscape Communications Corporation, All Rights Reserved
  5.  * 
  6.  * Functions that manage the options->layout preference panel
  7.  */
  8.  
  9. function fillDefaultList(theForm, category, selector) {
  10.     var channelArray = selector.parent.titlebar.document.demo.getData(category);
  11.     var curOption;
  12.     var channelArrayLength;
  13.     var chanPrefsName;
  14.     var defaultChannelName = depth.GetNetscapePref("netcaster.defaultChannel", "", false);
  15.     var defaultChannelIndex = -1;
  16.  
  17.     if ( null == channelArray ) {
  18.         channelArrayLength = 0;
  19.  
  20.         for (i = 0; i < theForm.defaultChannel.length; i++) {
  21.             if (i==0) {
  22.                 theForm.defaultChannel.options[i].text = "(No channels)";
  23.                 defaultChannelIndex = -1;
  24.             } else {
  25.                 theForm.defaultChannel.options[i] = null;
  26.             }
  27.         }
  28.  
  29.     } else
  30.         channelArrayLength = channelArray.length;
  31.  
  32.     for (i = 0; i < channelArrayLength; i++) 
  33.     {
  34.         chanPrefsName = channelArray[i].getPrefsName();
  35.         if ((defaultChannelName != "") && (chanPrefsName == defaultChannelName)) {
  36.             defaultChannelIndex = i;
  37.         }
  38.  
  39.         curOption = new Option(channelArray[i].getItemName());
  40.             curOption.prototype = channelArray[i];
  41.         theForm.defaultChannel.options[i] = curOption;
  42.     }
  43.  
  44.     if (defaultChannelIndex == -1) {
  45.         theForm.onDefault[0].checked = true;
  46.         theForm.defaultChannel.selectedIndex = 0;
  47.     } else {
  48.         theForm.onDefault[1].checked = true;
  49.         theForm.defaultChannel.selectedIndex = defaultChannelIndex;
  50.     }
  51. }
  52.  
  53. function loadValues()
  54. {
  55.     var drawerDock = depth.GetNetscapePref("netcaster.drawer.dock", "right", false);
  56.  
  57.     if (drawerDock == "left") {
  58.         document.layout_form.drawerPos.selectedIndex = 1; 
  59.     } else {
  60.         document.layout_form.drawerPos.selectedIndex = 0; 
  61.     }
  62.  
  63.     var drawerHide = depth.GetNetscapePref("netcaster.drawer.autoHide", "true", false);
  64.     if (drawerHide == "false") {
  65.         document.layout_form.autoHide.checked = false; 
  66.     } else {
  67.         document.layout_form.autoHide.checked = true; 
  68.     }
  69.  
  70.     fillDefaultList(document.layout_form, depth.getDefaultContainer(), opener);
  71.  
  72.     window.layoutLoaded = true;
  73. }
  74.  
  75. void(0);